<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>表单</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" th:href="@{/admin/plugins/layui/css/layui.css}" media="all" />
		<link rel="stylesheet" th:href="@{/admin/plugins/font-awesome/css/font-awesome.min.css}">
	</head>

	<body>
		<div style="margin: 15px;">
			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
				<legend>添加场地</legend>
			</fieldset>

			<form class="layui-form" method="post" action="/product/add" enctype="multipart/form-data">
				<div class="layui-form-item" style="display:none;">
					<label class="layui-form-label">类型</label>
					<div class="layui-input-block">
						<input type="text" name="type"  value="场地" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">标题</label>
					<div class="layui-input-block">
						<input type="text" value="惠州十里银滩·棕榈滩11号别墅" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">使用时间</label>
					<div class="layui-input-block">
						<input type="text" name="validTime" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">所在城市</label>
					<div class="layui-input-block">
						<input type="text" name="city" value="南宁" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">价格</label>
					<div class="layui-input-block">
						<input type="text" name="value" value="200" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">地址</label>
					<div class="layui-input-block">
						<input type="text" value="南宁市惠东县碧桂园十里银滩棕榈滩三区" name="address" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">适用人数</label>
					<div class="layui-input-block">
						<input type="text" value="10" name="numberPeople" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">床位数</label>
					<div class="layui-input-block">
						<input type="text" value="6"  name="numberBed" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">房间数</label>
					<div class="layui-input-block">
						<input type="text" value="3" name="numberRoom" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">配套实施</label>
					<div class="layui-input-block">
						<input type="text" name="supportingFacility" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">标签</label>
					<div class="layui-input-block">
						<input type="text" value="毗邻景区|私人花园|海景度假|豪华装修" name="blurbLabel" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">补充介绍</label>
					<div class="layui-input-block">
						<input type="text" value="二楼：1.8米大床房1间，1.5米双床房1间" name="supplement" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">温馨提示</label>
					<div class="layui-input-block">
						<input type="text" value="别墅提供两个免费停车位，其余停到停车场20元/天" name="warmPrompt" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">详细描述</label>
					<div class="layui-input-block">
						<textarea class="layui-textarea layui-hide" name="description" lay-verify="content" id="LAY_demo_editor"></textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" type="submit" lay-submit="" lay-filter="demo1">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
		<script type="text/javascript" src="/admin/plugins/layui/layui.js"></script>
		<script type="text/javascript" src="/js/jquery.min.js"></script>
		<script>
			layui.use(['form', 'layedit', 'laydate'], function() {
				var form = layui.form(),
					layer = layui.layer,
					layedit = layui.layedit,
					laydate = layui.laydate;

				//创建一个编辑器
				var editIndex = layedit.build('LAY_demo_editor');
				//自定义验证规则
				
				form.verify({
					title1: function(value) {
						if(value.length < 5) {
							return '标题至少得5个字符啊';
						}
					},
					pass: [/(.+){6,12}$/, '密码必须6到12位'],
					content: function(value) {
						layedit.sync(editIndex);
					}
				});

				//监听提交
				/*
				form.on('submit(demo1)', function(data) {
					$.ajax({
						url:'/product/add',
						dateType:'json',
						type:'post',
						data:$("form").serialize(),
						success:function(response){
							
						}
					});
					layer.alert("提交成功", {
						title: '最终的提交信息'
					})
					return false;
				});
				*/
			});
		</script>
	</body>

</html>